#ifndef GRAPHICPAINTERQT_H
#define GRAPHICPAINTERQT_H

#include "gui/graphicpainter.h"

namespace qtgui
{

    /**
    *      GraphicPainter -> Qt impl
    */

    class GraphicPainterQT : public gui::GraphicPainter
    {

        public:
            static GraphicPainterQT* GraphicPainterQT::create();

            virtual ~GraphicPainterQT();


//IMPLEMETS

            virtual void moveTo(int x, int y);
			virtual void lineTo(int x, int y);

			virtual void drawGridPoint(const Vector& p);
			virtual void drawPoint(const Vector& p);
            virtual void drawLine(const Vector& p1, const Vector& p2);
            //virtual void drawRect(const Vector& p1, const Vector& p2);
            virtual void drawArc(const Vector& cp, double radius,
                         double a1, double a2,
                         const Vector& p1, const Vector& p2,
                         bool reversed) { };
            virtual void drawArc(const Vector& cp, double radius,
                         double a1, double a2,
                         bool reversed) { };
/*
            void createArc(QPointArray& pa,
                   const Vector& cp, double radius,
                   double a1, double a2,
                   bool reversed);
*/
            virtual void drawCircle(const Vector& cp, double radius) { };
            virtual void drawEllipse(const Vector& cp,
                             double radius1, double radius2,
                             double angle,
                             double angle1, double angle2,
                             bool reversed) { };
/*
            virtual void drawImg(RS_Img& img, const Vector& pos,
                        double angle, const Vector& factor,
                        int sx, int sy, int sw, int sh) { };
*/

            virtual void drawTextH(int x1, int y1, int x2, int y2,
                           const std::string& text) { };
            virtual void drawTextV(int x1, int y1, int x2, int y2,
                           const std::string& text) { };
/*
            virtual void fillRect(int x1, int y1, int w, int h,
                          const RS_Color& col) { };
*/
            virtual void fillTriangle(const Vector& p1,
                              const Vector& p2,
                              const Vector& p3) { };

/*
            virtual void drawHandle(const Vector& p, const RS_Color& c, int size=-1);
*/
            virtual void setPreviewPen() { };
/*
            virtual RS_Pen getPen() { };
            virtual void setPen(const RS_Pen& pen) { };
            virtual void setPen(const RS_Color& color) { };
*/
            virtual void setPen(int r, int g, int b) { };
            virtual void disablePen() { };
/*
            virtual void setBrush(const RS_Color& color) { };
            virtual void drawPolygon(const RS_PointArray& a) { };
*/
            virtual void erase() { };
            virtual int getWidth() { return 0; };
            virtual int getHeight() { return 0; };

            virtual void setXORMode() { };
            virtual void setNormalMode() { };


            virtual void setClipRect(int x, int y, int w, int h) { };
            virtual void resetClipping() { };


//////

            bool qt_painter_active();
            void qt_begin_painter();
            void qt_end_painter();
			QPainter& get_qt_painter()	{ return qt_painter;}

			void set_qt_widget(QWidget * qt_widget) {this->qt_widget = qt_widget;}
			QWidget* get_qt_widget() { return qt_widget; }
        protected:
            GraphicPainterQT();


        private:
            QPainter qt_painter;
            QWidget * qt_widget;

            Vector current_pos;

    };

}
#endif // GRAPHICPAINTERQT_H
